﻿//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Data;
//using System.Drawing;
//using System.Linq;
//using System.Text;
//using System.Windows.Forms;
//using Microsoft.Reporting.WinForms;
//using S3.common;

//namespace S3.Report
//{
//    public partial class RevenueReportForm : Form
//    {
//        public RevenueReportForm()
//        {
//            InitializeComponent();
//            for (int i = 2010; i < 2021; i++)
//            {
//                cmbFromYear.Items.Add(i);
//                cmbToYear.Items.Add(i);
//                cmbYears.Items.Add(i);
//                cmbYears.SelectedItem = DateTime.Now.Year;
//            }
//            pnlByYear.Visible = false;
//        }

//        #region Event Handlers

//        private void RevenueReportForm_Load(object sender, EventArgs e)
//        {
//            var data = ReportUtils.GetDataForMonthlyReport(DateTime.Now.Year);
//            ReportModelBindingSource.DataSource = data;
//            this.reportViewer.RefreshReport();
//        }

//        private void CheckedChange(object sender, EventArgs e)
//        {
//            pnlByMonth.Visible = !rdioBtnByYear.Checked;
//            pnlByYear.Visible = rdioBtnByYear.Checked;
//        }

//        private void btnView_Click(object sender, EventArgs e)
//        {
//            var data = new List<ReportModel>();
//            if (rdioBtnByMonth.Checked)
//            {
//                data = ReportUtils.GetDataForMonthlyReport(Convert.ToInt32(cmbYears.SelectedItem));

//            }
//            else
//            {
//                if (cmbFromYear.SelectedIndex != -1 && cmbToYear.SelectedIndex != -1 &&
//                    Convert.ToInt32(cmbFromYear.SelectedItem) <= Convert.ToInt32(cmbToYear.SelectedItem))
//                {
//                    data = ReportUtils.GetDataForYearlyReport(Convert.ToInt32(cmbFromYear.SelectedItem),
//                                                              Convert.ToInt32(cmbToYear.SelectedItem));
//                    //S3.Report.BudgetReport.rdlc
//                    reportViewer.LocalReport.ReportEmbeddedResource = "S3.Report.RevenueReportByYear.rdlc";
                   
//                }
//            }
//            ReportModelBindingSource.DataSource = data;
//            this.reportViewer.RefreshReport();
//        }

//        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
//        {
//            if (msg.WParam.ToInt32() == (int)Keys.Escape)
//            {
//                this.Close();
//            }
//            else
//            {
//                return base.ProcessCmdKey(ref msg, keyData);
//            }
//            return base.ProcessCmdKey(ref msg, keyData);
//        }

//        #endregion

//    }
//}
